import { watch } from 'less';
import { defineStore } from 'pinia'
import { getlyric } from "../api/user";

// useStore 可以是 useUser、useCart 之类的任何东西
// 第一个参数是应用程序中 store 的唯一 id
export const useStore = defineStore('main', {
    // other options...
    state: () => {
        return {
            songsheets:{
                0:{
                 name: '落下(いっぱつにゅうこんver.)',
                 id:484249940,
                  pst: 0,
                  t: 0, 
                  ar: {id: 12467180, name: '日向文'}, 
                  al:{
                    id:35630143,
                    name:  "cry",
                    pic: 19035844811868070,
                    picUrl : "https://p2.music.126.net/DEkk-OIlzDVxsoo1tW-Dug==/19035844811868074.jpg",
                    pic_str:  "19035844811868074"}
                },
                
            },
            songsheetid:2022470240,
            songsheetname:"等一场痛快",
            songsindex:0,
            judgeplay:true,
            lyrics:[],
            playbacktime:0,
            footmu:true,
            token:'',
            //gosoid:0
            //songfun:()=>{}
        }
    },
    getters: {
        getjudgeplay: (state) => {
            return (value)=>state.judgeplay = value
        },
        getsongdata:(state)=>{
            return (data)=>{
                state.songsheets=data.songsheets;
                state.songsheetid=data.id;
                state.songsheetname=data.name;
                state.judgeplay=true;
                state.songsindex=data.songsindex;
            }
        },
        getly:(state)=>{
            return (data)=>{state.lyrics=data}
        },
        switchplaysong:(state)=>{
            return (id)=>{state.songsindex=id;}
        },
        switchsongsheet:(state)=>{
            return (data)=>{state.songsheets=data;}
        },
        switchplaybacktime:(state)=>{
            return (time)=>{state.playbacktime=time}
        },
        getfootmu:(state)=>{
           return(value)=>{state.footmu=value}
        },
        gettoken:(state)=>{
            return(to)=>{state.token=to}
        },
        // getgoso:(state)=>{
        //     return(id)=>{
        //         state.gosoid=id
        //     }
        // }


    },
    actions: {
    

       // }
        // getjudgeplay: (state) => {
        //     return (value)=>state.judgeplay = value
        // },
        // getsongdata:(state)=>{
        //     return (data)=>{
        //         state.al=data.al;
        //         state.songsheetid=data.id;
        //         state.judgeplay=true;
        //     }
        // },

     },

})